<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>大学生宿舍首页</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
  <style>
    body {
      font-family: 'PingFang SC', '微软雅黑', sans-serif;
      margin: 0;
      padding: 0;
      background: linear-gradient(135deg, #f0f4f8, #d9e4f2);
      color: #333;
      opacity: 0;
      transition: opacity 1s ease;
    }

    .header {
      background-color: #0073e6;
      padding: 20px 0;
      text-align: center;
      color: white;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      position: relative;
      z-index: 10;
    }

    .logo {
      font-size: 32px;
      font-family: 'Pacifico', cursive;
      font-weight: bold;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }

    .slogan {
      font-size: 16px;
      font-family: '微软雅黑', sans-serif;
      font-weight: normal;
      color: rgba(255, 255, 255, 0.8);
    }

    .nav {
      background-color: rgba(255, 255, 255, 0.9);
      padding: 10px 0;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      position: sticky;
      top: 0;
      z-index: 100;
      transition: background-color 0.3s ease;
    }

    .nav.scrolled {
      background-color: rgba(255, 255, 255, 0.95);
    }

    .nav ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
      display: flex;
      justify-content: center;
    }

    .nav ul li {
      margin: 0 15px;
    }

    .nav ul li a {
      text-decoration: none;
      color: #333;
      font-weight: bold;
      transition: color 0.3s ease, border-bottom 0.3s ease;
      padding-bottom: 5px;
      border-bottom: 2px solid transparent;
    }

    .nav ul li a:hover,
    .nav ul li a.active {
      color: #0073e6;
      border-bottom: 2px solid #0073e6;
    }

    .banner {
      position: relative;
      overflow: hidden;
      height: 400px;
      margin-top: 20px;
    }

    .banner img {
      width: 100%;
      height: 100%;
      object-fit: cover; /* 图片覆盖整个容器 */
      object-position: center; /* 图片居中显示 */
      position: absolute;
      top: 0;
      left: 0;
      opacity: 0;
      transition: opacity 1s ease;
    }

    .banner img.active {
      opacity: 1;
    }

    .banner-text {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      text-align: center;
      color: white;
      background-color: rgba(0, 0, 0, 0.5);
      padding: 20px;
      border-radius: 10px;
      z-index: 5;
      transition: opacity 1s ease;
    }

    .banner-text.hidden {
      opacity: 0;
    }

    .content {
      padding: 40px 20px;
      max-width: 1200px;
      margin: 0 auto;
    }

    .card {
      background-color: #fff;
      border-radius: 15px;
      box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
      overflow: hidden;
      margin-bottom: 20px;
      transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .card:hover {
      transform: translateY(-10px);
      box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    }

    .card img {
      width: 100%;
      height: 300px;
      object-fit: cover; /* 图片覆盖整个容器 */
      object-position: center; /* 图片居中显示 */
    }

    .card-content {
      padding: 20px;
    }

    .card-content h3 {
      margin: 0 0 10px;
      color: #0073e6;
    }

    .card-content p {
      margin: 0;
      color: #666;
    }

    .footer {
      background-color: #0073e6;
      color: white;
      text-align: center;
      padding: 20px 0;
    }

    .footer p {
      margin: 5px 0;
    }

    #backToTop {
      position: fixed;
      bottom: 20px;
      right: 20px;
      display: none;
      cursor: pointer;
      font-size: 24px;
      color: #0073e6;
      background-color: white;
      border-radius: 50%;
      padding: 10px;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      transition: background-color 0.3s ease;
    }

    #backToTop:hover {
      background-color: #f0f4f8;
    }

    .loading {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: #0073e6;
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 1000;
    }

    .loading-spinner {
      border: 4px solid rgba(255, 255, 255, 0.3);
      border-top: 4px solid white;
      border-radius: 50%;
      width: 40px;
      height: 40px;
      animation: spin 1s linear infinite;
    }

    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    /* 侧边栏样式 */
    .sidebar {
      position: fixed;
      top: 50%;
      right: 20px;
      transform: translateY(-50%);
      background-color: rgba(255, 255, 255, 0.9);
      border-radius: 10px;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      padding: 10px;
      z-index: 100;
    }

    .sidebar a {
      display: block;
      text-decoration: none;
      color: #0073e6;
      font-weight: bold;
      margin: 10px 0;
      transition: color 0.3s ease;
    }

    .sidebar a:hover {
      color: #005bb5;
    }

    .sidebar a i {
      margin-right: 8px;
    }
  </style>
</head>
<body>

<div class="loading">
  <div class="loading-spinner"></div>
</div>

<div class="header">
  <div class="logo">
    <span>5528宿舍</span>
    <span class="slogan">青春不散场，友谊永长存</span>
  </div>
</div>

<div class="nav" id="nav">
  <ul>
    <li><a href="index.HTML" class="active">首页</a></li>
    <li><a href="index2.html">宿舍成员</a></li>
    <li><a href="cht.html">宿舍生活</a></li>
    <li><a href="lcz.html">宿舍故事</a></li>
    <li><a href="cfx.HTML">关于我们</a></li>
  </ul>
</div>

<div class="banner">
  <div class="banner-text">
    <h1>欢迎来到5528宿舍</h1>
    <p>记录我们的青春时光</p>
  </div>
  <img src="img/syr.jpg" alt="宿舍生活" class="active">
  <img src="img/memory2.jpg" alt="宿舍生活">
  <img src="img/memory1.jpg" alt="宿舍生活">
</div>

<div class="content">
  <div class="card">
    <img src="img/memory3.jpg" alt="宿舍成员">
    <div class="card-content">
      <h3>宿舍简介</h3>
      <p>5528宿舍由五位成员组成：方顺、黎俊、海涛、朝政和范校。我们来自不同的地方，但在这里成为了最好的朋友。</p>
    </div>
  </div>
  <div class="card">
    <img src="img/memory1.jpg" alt="最新动态">
    <div class="card-content">
      <h3>最新动态</h3>
      <p>最近我们一起去吃了烤鱼，度过了愉快的时光。</p>
    </div>
  </div>
  <div class="card">
    <img src="img/bd.jpg" alt="精彩瞬间">
    <div class="card-content">
      <h3>精彩瞬间</h3>
      <p>霸道总裁海涛</p>
    </div>
  </div>
</div>

<div class="footer">
  <p>版权所有 &copy; 5528全体宿舍成员</p>
  <p>联系方式：3478196734.com</p>
</div>

<!-- 侧边栏 -->
<div class="sidebar">
  <a href="https://hceb.edu.cn/" target="_blank"><i class="fas fa-school"></i>学校官网</a>
  <a href="https://lib.hceb.edu.cn/" target="_blank"><i class="fas fa-university"></i>学校图书馆</a>
  <a href="https://jw2.hceb.edu.cn/jwglxt/xtgl/login_slogin.html" target="_blank"><i class="fas fa-home"></i>教务信息平台</a>
</div>

<i id="backToTop" class="fas fa-chevron-up"></i>

<script>
  // 页面加载动画
  window.addEventListener('load', () => {
    document.querySelector('.loading').style.display = 'none';
    document.body.style.opacity = '1';

    // 3 秒后隐藏 banner-text
    const bannerText = document.querySelector('.banner-text');
    setTimeout(() => {
      bannerText.classList.add('hidden');
    }, 3000); // 3 秒后执行
  });

  // 轮播图逻辑
  let bannerIndex = 0;
  const banners = document.querySelectorAll('.banner img');
  setInterval(() => {
    banners[bannerIndex].classList.remove('active');
    bannerIndex = (bannerIndex + 1) % banners.length;
    banners[bannerIndex].classList.add('active');
  }, 3000);

  // 返回顶部按钮逻辑
  const backToTop = document.getElementById('backToTop');
  window.addEventListener('scroll', () => {
    if (window.scrollY > 100) {
      backToTop.style.display = 'block';
    } else {
      backToTop.style.display = 'none';
    }
  });

  backToTop.addEventListener('click', () => {
    window.scrollTo({ top: 0, behavior: 'smooth' });
  });

  // 导航栏滚动效果
  const nav = document.getElementById('nav');
  window.addEventListener('scroll', () => {
    if (window.scrollY > 50) {
      nav.classList.add('scrolled');
    } else {
      nav.classList.remove('scrolled');
    }
  });
</script>

</body>
</html>